home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / cnews.orig.lzh / expire / Makefile < prev    next >
Makefile  |  1989-06-27  |  8KB  |  248 lines

  1. PROF = 
  2. COPTS = -O
  3. CFLAGS = $(COPTS) -I../include $(PROF)
  4. LINTFLAGS = -I../include
  5. JUNKLINT = 'possible pointer align'
  6. LDFLAGS = $(CFLAGS)
  7. DBM = -ldbm
  8. LIBS= ../libcnews.a
  9. THEM = expire histdups histinfo histslash mkdbm mkhistory \
  10.     superkludge upact doexpire mkadir
  11. DTR = README Makefile dircheck doexpire expire.c histdups histinfo.c \
  12.     histslash.c lowest.c mkdbm.c mkhistory pgood superkludge tgood upact \
  13.     mkadir
  14. # =()<NEWSARTS = @<NEWSARTS>@>()=
  15. NEWSARTS = /usr/spool/news
  16. # =()<NEWSBIN = @<NEWSBIN>@>()=
  17. NEWSBIN = /usr/lib/newsbin
  18. # =()<NEWSCTL = @<NEWSCTL>@>()=
  19. NEWSCTL = /usr/lib/news
  20. # workaround for System V make bug
  21. SHELL = /bin/sh
  22.  
  23. all:    $(THEM)
  24.  
  25. bininstall:    $(THEM) explist.proto
  26.     -if test ! -d $(NEWSBIN)/expire ; then mkdir $(NEWSBIN)/expire; fi
  27.     chmod +x $(THEM)
  28.     cp $(THEM) $(NEWSBIN)/expire
  29.  
  30. newsinstall:    explist.proto
  31.     -if test ! -r $(NEWSCTL)/explist ; then cp explist.proto $(NEWSCTL)/explist ; 
  32. i
  33.  
  34. cmp:    $(THEM)
  35.     -for f in $(THEM) ; do cmp $$f $(NEWSBIN)/expire/$$f ; done
  36.  
  37. expire: expire.o $(LIBS)
  38.     $(CC) $(LDFLAGS) expire.o $(LIBS) $(DBM) -o $@
  39.  
  40. histinfo: histinfo.o $(LIBS)
  41.     $(CC) $(LDFLAGS) histinfo.o $(LIBS) -o $@
  42.  
  43. lowest:    lowest.o $(LIBS)
  44.     $(CC) $(LDFLAGS) lowest.o $(LIBS) -o $@
  45.  
  46. histslash:    histslash.o $(LIBS)
  47.     $(CC) $(LDFLAGS) histslash.o $(LIBS) -o $@
  48.  
  49. mkdbm:    mkdbm.o $(LIBS)
  50.     $(CC) $(LDFLAGS) mkdbm.o $(LIBS) $(DBM) -o $@
  51.  
  52. lint:    expire.c
  53.     lint -ha $(LINTFLAGS) expire.c 2>&1 | egrep -v $(JUNKLINT) | tee $@
  54.  
  55. explist.proto:
  56.     echo "# hold onto history lines 14 days, nobody gets >90 days" >$@
  57.     echo "/expired/            x    14    -" >>$@
  58.     echo "/bounds/            x    0-1-90    -" >>$@
  59.     echo >>$@
  60.     echo "# override later defaults for some groups of note" >>$@
  61.     echo "sci.space.shuttle,rec.birds    x    7    @" >>$@
  62.     echo >>$@
  63.     echo "# big non-tech groups held long enough for a long weekend" >>$@
  64.     echo "sci,rec,talk,soc,misc,alt    u    4    -" >>$@
  65.     echo >>$@
  66.     echo "# real noise gets thrown away fast" >>$@
  67.     echo "news.groups            x    2    -" >>$@
  68.     echo "junk,tor.news.stats        x    2    -" >>$@
  69.     echo >>$@
  70.     echo "# throw away some technical stuff not worth archiving" >>$@
  71.     echo "comp.os.vms,comp.mail.maps    x    7    -" >>$@
  72.     echo >>$@
  73.     echo "# default:  7 days and archive" >>$@
  74.     echo "all                x    7    @" >>$@
  75.  
  76. # setup for regression test
  77. setup:
  78.     rm -f explist history active active.after history.proto
  79.     rm -rf arts arch arch2 arch3 nbin
  80.     >history.pag
  81.     >history.dir
  82.     echo "/expired/    x    0.08    -" >>explist
  83.     echo '/bounds/    x    0.01-0.1-0.11    -' >>explist
  84.     echo "bar,!bar.ugh    x    0.05    `pwd`/arch2" >>explist
  85.     echo 'mod    m    0.1    @' >>explist
  86.     echo 'mod    u    0.05    -' >>explist
  87.     echo 'urp    x    0.01-0.05-0.1    -' >>explist
  88.     echo "bletch    x    0.1    =`pwd`/arch3/bletch" >>explist
  89.     echo 'all    x    0.1    @' >>explist
  90.     mkdir nbin nbin/expire
  91.     for f in $(THEM) ; do ln $$f nbin/expire/$$f ; done
  92.     echo 'ln $$* >/dev/null 2>/dev/null' >nbin/newslock
  93.     echo 'echo 10' >nbin/spacefor
  94.     chmod +x nbin/* nbin/expire/*
  95.     mkdir arts arts/foo arts/bar arts/bar/ugh arts/urp arch arch2
  96.     mkdir arts/mod arts/mod/mod arts/mod/unmod arch3 arch3/bletch
  97.     mkdir arts/bletch
  98.     echo 'foo 00099 00000 y' >>active
  99.     echo 'foo 00099 00001 y' >>active.after
  100.     echo 'bar 00099 00000 m' >>active
  101.     echo 'bar 00099 00099 m' >>active.after
  102.     echo 'bar.ugh 00099 00000 m' >>active
  103.     echo 'bar.ugh 00099 00099 m' >>active.after
  104.     echo 'urp 00099 00000 n' >>active
  105.     echo 'urp 00099 00007 n' >>active.after
  106.     echo 'mod.mod 00013 00000 m' >>active
  107.     echo 'mod.mod 00013 00013 m' >>active.after
  108.     echo 'mod.unmod 00016 00000 y' >>active
  109.     echo 'mod.unmod 00016 00016 y' >>active.after
  110.     echo 'bletch 00099 00000 y' >>active
  111.     echo 'bletch 00099 00099 y' >>active.after
  112.     echo '<wont1>    9999~-    foo/1' >>history.proto
  113.     echo :foo/1: >arts/foo/1
  114.     echo 'Message-ID: <wont1>' >>arts/foo/1
  115.     echo '<will2>    1000~-    foo/2' >>history.proto
  116.     echo foo/2 >arts/foo/2
  117.     echo '<will3>    1000~100    foo/3' >>history.proto
  118.     echo foo/3 >arts/foo/3
  119.     echo '<two4>    100    bar/4' >>history.proto
  120.     echo :bar/4: >arts/bar/4
  121.     echo 'Subject: yes' >>arts/bar/4
  122.     echo '<will5>    100~    bar.ugh/5' >>history.proto
  123.     echo :bar/ugh/5: >arts/bar/ugh/5
  124.     echo >>arts/bar/ugh/5
  125.     echo 'Subject: no' >>arts/bar/ugh/5
  126.     echo '<gone6>    100~-    urp/6' >>history.proto
  127.     echo urp/6 >arts/urp/6
  128.     echo '<wont7>    9999~9999~xx~a    urp/7' >>history.proto
  129.     echo :urp/7: >arts/urp/7
  130.     echo 'Message-ID: <wont7>' >>arts/urp/7
  131.     echo 'Expires: 9999' >>arts/urp/7
  132.     echo '<gone8>    100~20000    urp/8' >>history.proto
  133.     echo urp/8 >arts/urp/8
  134.     echo '<gone9>    100~-    urp/9' >>history.proto
  135.     echo '<wont10>    1000~20000    foo/10' >>history.proto
  136.     echo :foo/10: >arts/foo/10
  137.     echo 'Message-ID: <wont10>' >>arts/foo/10
  138.     echo 'Expires: 20000' >>arts/foo/10
  139.     echo 'Supersedes: <wont1>' >>arts/foo/10
  140.     echo >>arts/foo/10
  141.     echo '<will11>    100~20000    foo/11' >>history.proto
  142.     echo foo/11 >arts/foo/11
  143.     echo '<will12>    100~-    mod.mod/12' >>history.proto
  144.     echo mod/mod/12 >arts/mod/mod/12
  145.     echo '<wont13>    2000    mod.mod/13' >>history.proto
  146.     echo :mod/mod/13: >arts/mod/mod/13
  147.     echo 'Message-ID: <wont13>' >>arts/mod/mod/13
  148.     echo '<gone14>    100~-    mod.unmod/14' >>history.proto
  149.     echo mod/unmod/14 >arts/mod/unmod/14
  150.     echo '<gone15>    2000    mod.unmod/15' >>history.proto
  151.     echo mod/unmod/15 >arts/mod/unmod/15
  152.     echo '<wont16>    9999~-    mod.unmod/16' >>history.proto
  153.     echo :mod/unmod/16: >arts/mod/unmod/16
  154.     echo 'Message-ID: <wont16>' >>arts/mod/unmod/16
  155.     echo '<three17>    100~-    bletch/17' >>history.proto
  156.     echo bletch/17 >arts/bletch/17
  157.     egrep wont history.proto >history.after
  158.     echo '<gone96>    5000~-    /' >>history.proto
  159.     echo '<gone96>    5000~-' >>history.after
  160.     echo '<gone97>    5000~-' >>history.proto
  161.     echo '<gone97>    5000~-' >>history.after
  162.     echo '<gone98>    5000~-    urp/98' >>history.proto
  163.     echo '<gone98>    5000~-' >>history.after
  164.     echo urp/98 >arts/urp/98
  165.     echo '<multi99>    5000~-    bar/99, bar.ugh/99  foo/99 urp/99' >>history.proto
  166.     echo '<multi99>    5000~-    bar.ugh/99 foo/99' >>history.after
  167.     echo :foo/99:bar/99:bar/ugh/99:urp/99: >arts/foo/99
  168.     echo 'Message-ID: <multi99>' >>arts/foo/99
  169.     ln arts/foo/99 arts/bar/99
  170.     ln arts/foo/99 arts/bar/ugh/99
  171.     ln arts/foo/99 arts/urp/99
  172.     cp history.proto history
  173.  
  174. # regression test machinery
  175. D = NEWSARTS=`pwd`/arts NEWSCTL=`pwd` NEWSBIN=`pwd`/nbin
  176. RUN = $(D) ./expire -a `pwd`/arch -n 10000
  177. FIXMIDFIELD = 's/    [0-9]*~*/    ~/;s/~    /~-    /;s/~xx~a//'
  178. FIXPATHS = "s;`pwd`;P;g"
  179. goodt:    expire setup    # do NOT run this unless you know what you're doing
  180.     $(RUN) -t explist 2>&1 | sed $(FIXPATHS) >tgood
  181.     chmod -w tgood
  182. goodp:    expire setup    # do NOT run this unless you know what you're doing
  183.     $(RUN) -p explist >pgood 2>&1
  184.     chmod -w pgood
  185. doit:    expire        # for debugging
  186.     echo "$(RUN) -t explist" >$@
  187.     chmod +x $@
  188.  
  189. # the regression test proper
  190. r:    $(THEM) dircheck setup tgood pgood
  191.     chmod +x dircheck $(THEM)
  192.     $(RUN) -c explist
  193.     : "okay, it's sane"
  194.     $(RUN) -t explist >test.out 2>&1
  195.     sed $(FIXPATHS) test.out | cmp - tgood
  196.     : "okay, it seems to know what it's doing -- now, can it do it?"
  197.     $(RUN) -p explist >test.out 2>test.stderr
  198.     test ! -s test.stderr
  199.     cmp test.out pgood
  200.     test ! -f history.n
  201.     cmp history.proto history.o
  202.     egrep wont history.proto | ./dircheck arts
  203.     egrep 'will|two|gone|three' history.proto | ./dircheck -n arts
  204.     egrep will history.proto | ./dircheck arch
  205.     egrep 'wont|two|gone|three' history.proto | ./dircheck -n arch
  206.     egrep two history.proto | ./dircheck arch2
  207.     egrep 'will|wont|gone|three' history.proto | ./dircheck -n arch2
  208.     egrep three history.proto | ./dircheck arch3
  209.     egrep 'will|wont|gone|two' history.proto | ./dircheck -n arch3
  210.     test -f arts/foo/99
  211.     test -f arts/bar/ugh/99
  212.     test -f arch2/bar/99
  213.     test ! -f arts/urp/99
  214.     cmp history history.after
  215.     : "that's it for expire, on to upact"
  216.     $(D) ./upact
  217.     cmp active active.after
  218.     : "and for upact, on to mkhistory"
  219.     awk -F'    ' 'NF > 2' history | sed $(FIXMIDFIELD) | sort >history.after
  220.     rm -f history.pag history.dir
  221.     $(D) ./mkhistory
  222.     sort history | sed $(FIXMIDFIELD) | cmp - history.after
  223.     test -r history.pag
  224.     test -r history.dir
  225.     : "and that's mkhistory done, finally try superkludge"
  226.     test -r arts/foo/1
  227.     test -r arts/foo/10
  228.     $(D) ./superkludge foo
  229.     test ! -r arts/foo/1
  230.     test -r arts/foo/10
  231.     : "success!"
  232.  
  233. tidy:
  234.     rm -f junk history history.pag history.dir history.o active
  235.     rm -f history.n* mon.out history.proto history.after test.out doit
  236.     rm -f active.old active.new explist lint active.after test.stderr
  237.     rm -rf arts arch arch2 arch3 nbin
  238.  
  239. clean:    tidy
  240.     rm -f *.o expire histslash mkdbm histinfo lowest explist.proto
  241.     rm -f dtr
  242.  
  243. spotless:    clean    # don't run this unless you know what you're doing
  244.     rm -f pgood tgood
  245.  
  246. dtr:    $(DTR)
  247.     makedtr $(DTR) >$@
  248.